package com.fulong.controller;

import java.util.Arrays;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.fulong.entity.DeviceMoneyInfoEntity;
import com.fulong.service.DeviceMoneyInfoService;
import com.fulong.common.utils.PageUtils;
import com.fulong.common.utils.R;



/**
 * 
 *
 * @author fulong
 * @email ${email}
 * @date 2022-04-20 22:37:28
 */
@RestController
@RequestMapping("/devicemoneyinfo")
public class DeviceMoneyInfoController {
    @Autowired
    private DeviceMoneyInfoService deviceMoneyInfoService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = deviceMoneyInfoService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") String id){
		DeviceMoneyInfoEntity deviceMoneyInfo = deviceMoneyInfoService.getById(id);

        return R.ok().put("deviceMoneyInfo", deviceMoneyInfo);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    public R save(@RequestBody DeviceMoneyInfoEntity deviceMoneyInfo){
		deviceMoneyInfoService.save(deviceMoneyInfo);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public R update(@RequestBody DeviceMoneyInfoEntity deviceMoneyInfo){
		deviceMoneyInfoService.updateById(deviceMoneyInfo);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public R delete(@RequestBody String[] ids){
		deviceMoneyInfoService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
